package com.team20.map_demo.service;

import com.team20.map_demo.domain.Region;
import com.team20.map_demo.domain.RegionExample;
import com.team20.map_demo.domain.SearchRegionResponse;
import com.team20.map_demo.mapper.RegionMapper;
import io.micrometer.core.instrument.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RegionServiceImpl implements RegionService {
    @Autowired
    private RegionMapper regionMapper;

    @Override
    public int saveRegion(Region region) {
        if (StringUtils.isNotBlank(region.getId())) {
            return regionMapper.updateByPrimaryKey(region);
        } else {
            return regionMapper.insert(region);
        }
    }

    @Override
    public SearchRegionResponse findAllRegion(Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public Region findRegionByPrimaryKey(String id) {
        return regionMapper.selectByPrimaryKey(id);
    }

    @Override
    public int deleteRegion(String id) {
        return regionMapper.deleteByPrimaryKey(id);
    }

    @Override
    public SearchRegionResponse findRegionLikeName(String keywords, Integer pageNum, Integer pageSize) {
        return null;
    }

    @Override
    public List<Region> listRegion() {
        return null;
    }

    @Override
    public Region findRegionByStreet(String id) {
        return null;
    }
}